package com.changgou.item.controller;

import com.changgou.item.service.PageService;
import com.changgou.util.Result;
import com.changgou.util.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*****
 * @Author: 黑马训练营
 * @Description: com.changgou.item.controller
 ****/
@RestController
@RequestMapping(value = "/page")
public class PageController {

    @Autowired
    private PageService pageService;

    /***
     * 根据SpuId生成详情页
     * id:Spu的id
     */
    @GetMapping(value = "/createHtml/{id}")
    public Result createHtml(@PathVariable(value = "id")String id){
        //调用Service实现页面生成
        pageService.createPageHtml(id);
        return new Result(true, StatusCode.OK,"生成静态页成功！");
    }
}
